package com.museum.demo.Controller;

import com.museum.demo.Dao.MuseumEntityMapper;
import com.museum.demo.Entity.ExhibitEntity;
import com.museum.demo.Interface.Result;
import com.museum.demo.Service.ExhibitService;
import com.museum.demo.Service.MuseumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

public class ExhibitController {
    @Autowired
    private ExhibitService exhibitService;

    @Autowired
    private MuseumEntityMapper museumEntityMapper;

    @Autowired
    private MuseumService museumService;

    @RequestMapping("/searchExList")
    public Result searchExList(String MuseumName){
        List<ExhibitEntity> respone = new ArrayList<>();
        int museumid = museumEntityMapper.searchMuseumIdByName(MuseumName);
        respone = exhibitService.SearchExhibitByMuseum(museumid);

        if(respone != null){
            return Result.Success(respone);
        }
        return null;
    }
}
